package cn.lili.modules.system.client;

import cn.lili.modules.constant.ServiceConstant;
import cn.lili.modules.system.entity.dos.Dictionary;
import cn.lili.modules.system.entity.dos.Setting;
import cn.lili.modules.system.fallback.SettingFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 系统配置 client
 *
 * @author Chopper
 * @version v1.0
 * 2021-11-08 09:52
 */
@FeignClient(path = "${server.servlet.context-path}", name = ServiceConstant.SYSTEM_SERVICE, contextId = "dictionary",fallback = SettingFallback.class)
public interface DictionaryClient {

    /**
     * 获取字典配置
     */
    @GetMapping("/feign/dictionary/{code}")
    List<Dictionary> getListByCode(@PathVariable("code") String code);

    @PostMapping("/feign/save")
    public Boolean save(@RequestBody Dictionary dictionary);

    @GetMapping("/feign/updateValueName")
    public Boolean updateValueName(@RequestParam String oldMhPrefix,@RequestParam String newMhPrefix);

    @PostMapping("/feign/getDict")
    public Dictionary getDict(@RequestBody Dictionary dictionary);

    @PostMapping("/feign/autoIncrement")
    public String autoIncrement(@RequestParam String valueName,@RequestParam String code);

}
